<?php
/*Problem Domain
To create a class that represents the TrainingSession class entity in TMS where 
consider admin will add available Training sessions only and later status can be changed to
	- TrainingSession.NOTAVAILABLE or
	- TrainingSession.POSTPONED

if available TrainingSession is changed to TrainingSession.NOTAVAILABLE then it has to be
	- TrainingSession.POSTPONED only

if available TrainingSession is changed to TrainingSession.POSTPONED then it can be changed to
	- TrainingSession.AVAILABLE or
	- TrainingSession.NOTAVAILABLE or
	- TrainingSession.POSTPONED
*/

/*
- Session is new TrainingSession(int, String, String, DateTime, int, String, DateTime, int)

- interp . new TrainingSession(sess_id, sess_name, trainer, start_datetime, status, desc, post_datetime, tech_id) represents the 
Training Sessions Entity of the TMS where
	- sess_id is the unique session ID .
	- sess_name is the name given to the session.
	- trainer is the name of the trainer for the session.
	- start_datetime is the date and the time on which the session is scheduled.
	- status is one of
		- 'notavailable' means the session is not avaliable.
		- 'available' means the session is avaliable.
		- 'postponed' means the session is postponed.
	- desc is a short description about the topics covered for the technology in the session.
	- post_datetime is one of
		-null inidicates that the session is not postponed.
		-DateTime inidicates that the session is postponed to this DateTime.
	- tech_id is the Technology ID for which the session is scheduled.

- Example .
$sess1 = new TrainingSession("phpsession", "ketul", date("2015-02-08 11:14:15.638276"), Session.AVALIABLE, 'arrays,functions');
$sess2 = new TrainingSession("webuisession", "piyush", date("2015-01-01 10:00:00"), Session.AVAILABLE);

- Template .
function fn-for-TrainingSession()
{
	...$this->sess_id;	//int
	...$this->sess_name;	//String
	...$this->trainer;	//String
	...$this->start_datetime;//DateTime
	...$this->status; 	//int
	...$this->desc		//int
	...$this->post_datetime;//DateTime
	...$this->tech_id	//int
}
*/

class TrainingSession
{
	private $sess_id;
	private $sess_name;
	private $trainer;
	private $start_datetime;
	private $status;
	private $desc;
	private $post_datetime;
	private $tech_id;

	const NOTAVAILABLE = 'notavailable';
	const AVAILABLE    = 'available';
	const POSTPONED    = 'postponed';

	/*int, String, String, Date, int
	purpose. To initialize the newly created Session*/
	public function __construct($sess_name, $trainer, $start_datetime, $status = self::AVAILABLE, $desc = null, $sess_id = null, 
					$tech_id = null)
	{
		$this->sess_name = $sess_name;     
        	$this->trainer = $trainer;
        	$this->start_datetime = $start_datetime;
        	$this->status = $status;
		$this->desc = $desc;      
		$this->sess_id = $sess_id;
		$this->tech_id = $tech_id;
	}

	/*void -> int
        purpose. produces the session ID of the current Session*/
        public function getId()
        {
                return $this->sess_id;
        }

        /*int -> void
        purpose. sets the given session ID for the current Session*/
        public function setId($sess_id)
        {
                $this->sess_id = $sess_id;
        }

	/*void -> String
        purpose. produces the session name of the current Session*/
        public function getSessionName()
        {
                return $this->sess_name;
        }

        /*int -> void
        purpose. sets the given session name for the current Session*/
        public function setSessionName($sess_name)
        {
                $this->sess_name = $sess_name;
        }


	/*void -> String
        purpose. produces the trainer for the current Session*/
        public function getTrainer()
        {
                return $this->trainer;
        }

        /*String -> void
        purpose. sets the given trainer for the current Session*/
        public function setTrainer($trainer)
        {
                $this->trainer = $trainer;
        }

	/*void -> DateTime
        purpose. produces the DateTime of the current Session*/
        public function getStartDateTime()
        {
                return strtotime($this->start_datetime);
        }

        /*DateTime -> void
        purpose. sets the given Date for the current Session*/
        public function setStartDateTime($start_datetime)
        {
                $this->start_datetime = $start_datetime;
        }

	/*void -> int
        purpose. produces the status of the current Session*/
        public function getStatus()
        {
                return $this->status;
        }

        /*int -> void
        purpose. sets the given status for the current Session*/
        public function setStatus($status)
        {
                $this->status = $status;
        }

	/*void -> String
        purpose. produces the description of topics covered int the current Session*/
        public function getDesc()
        {
                return $this->desc;
        }

        /*int -> void
        purpose. sets the given description of topics covered for the current Session*/
        public function setDesc($desc)
        {
                $this->desc = $desc;
        }

	/*void -> DateTime
        purpose. produces the DateTime of the current Session*/
        public function getPostDateTime()
        {
                return strtotime($this->post_datetime);
        }

        /*DateTime -> void
        purpose. sets the given postponed DateTime for the current Session*/
        public function setPostDateTime($post_datetime)
        {
                $this->post_datetime = $post_datetime;
        }


	/*void -> int
        purpose. produces the technology ID of the current Session to which it belongs*/
        public function getTechId()
        {
                return $this->tech_id;
        }

        /*String -> void
        purpose. sets the given tech ID for the current Session*/
        public function setTechId($tech_id)
        {
                $this->tech_id = $tech_id;
        }

}
  
?>
